
<div class="row">
  <div class="col-md-3">
    <div class="card">
      <div class="card-body">
        <div class="form-group">
          <label class="form-label">设置列表</label>
          <div class="form-control-plaintext">
            <% Setting.all.each do |setting| %>
            <div><%= link_to "#{i18n_global(setting.var)}", admin_settings_path(setting_id: setting.id) %></div>
            <% end %>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="col-md-9">
    <div class="card">
      <div class="card-body">
        <h3 class="card-title"><%= i18n_global(@setting.var) %></h3>
        <div class="row">
          <div class="col-md-12">
            <div class="form-group">
              <label class="form-label"></label>
              <%= form_for [:admin, @setting] do |f| %>
                <% if @setting.field_type_area? %>
                  <%= f.text_area :value, class: "form-control", id: "term_of_service_editor" %>
                  <br />
                  <%= f.submit "保 存", class:"btn btn-primary" %>
                <% elsif @setting.field_type_text? %>
                  <div class="input-group">
                    <%= f.text_field :value, class: "form-control" %>
                    <span class="input-group-append">
                      <%= f.submit "保 存", class:"btn btn-primary" %>
                    </span>
                  </div>
                <% elsif @setting.field_type_radio? %>
                  <div class="custom-controls-stacked">
                    <% @setting.default_values.split('|').each do |default_value| %>
                    <label class="custom-control custom-radio custom-control-inline">
                      <% if @setting.value == default_value %>
                        <%= f.radio_button :value, default_value, { class: "custom-control-input", checked: "checked" } %>
                      <% else %>
                        <%= f.radio_button :value, default_value, { class: "custom-control-input" } %>
                      <% end %>
                      <span class="custom-control-label"><%= default_value %></span>
                    </label>
                    <% end %>
                  </div>
                  <br />
                  <%= f.submit "保 存", class:"btn btn-primary" %>
                <% end %>
              <% end %>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="col-md-2">
  </div>
</div>